<template>
  <div>
    <input placeholder="请输入任务名称" v-model="value" @keyup.enter="enter" />
  </div>
</template>
<script>
import { defineComponent, ref } from "vue";

export default defineComponent({
  name: "navHeader",
  setup(props, ctx) {
    let value = ref("");

    let enter = () => {
      // 触发父组件的add方法,参数为value的值
      ctx.emit("add", value.value);
      value.value = "";
      // console.log(value.value);
    };
    return {
      value,
      enter,
    };
  },
});
</script>
<style scoped lang='scss'>
</style>